import request from '../utils/request';

// 获取图书详情
export const getBookDetail = (bookId) => {
  return request.get(`/books/${bookId}`);
}

export const getBookCategories = () => {
  return request.get('/categorys/list');
}

export const getSearchReasult = (searchObj) => {
  return request.get('/books/search', {
    params: {
      keyword: searchObj.keyword,
      page: searchObj.page,
      pageSize: searchObj.pageSize
    }
  });
}

export const getNewBooks = () => {
  return request({
    url: '/books/new',
    method: 'get',
    params: {
      count: 8
    }
  });
}

export const getRecommendBooks = () => {
  return request({
    url: '/books/recommend',
    method: 'get',
    params: {
      count: 8
    }
  });
}

// 获取轮播图
export const getBannerBooks = () => {
  return request({
    url: '/books/banner',
    method: 'get',
    params: {
      count: 8
    }
  });
}

